from flask import jsonify
from .. import utils
from . import api


@api.route('/get_port_info/<sn>/')	
def get_port_info(sn):
	r=utils.exec_command(sn, 'curl -s http://115.29.151.181/webtool/video/get_port_info.sh | sh')
	return jsonify(r)

@api.route('/get_camera_ps/<sn>/')	
def get_camera_ps(sn):
	r=utils.exec_command(sn, 'curl -s http://115.29.151.181/webtool/video/get_camera_ps.sh | sh')
	return jsonify(r)

@api.route('/get_camera_ip/<sn>/')	
def get_camera_ip(sn):
	r=utils.exec_command(sn, 'curl -s http://115.29.151.181/webtool/video/get_camera_ip.sh | sh')
	return jsonify(r)

#Operate Video
@api.route('/opt_reboot_camera_ps/<sn>/')
def opt_reboot_camera_ps(sn):
	r=utils.exec_command(sn, '')
	return jsonify(r)

@api.route('/opt_port_switch/<sn>/')
def opt_port_switch(sn):
	r=utils.exec_command(sn, '')
	return jsonify(r)

@api.route('/opt_gateway_config/<sn>/')	#50
def opt_gateway_config(sn):
	#print paras
	r=utils.exec_command(sn, 'ifconfig br-lan1:2 192.168.1.1')
	return jsonify(r)
